<style>


</style>
<template>
<!-- 库存状况 -->
    <div>

              <Spin size="large" fix v-if="spinShow"></Spin>
    
              <!-- 根据条件查询 -->
    <div>
       <el-form :inline="true"  class="demo-form-inline" ref="ruleForm">
        <el-form-item label="单据编号">
          <el-input v-model="documentNumber" placeholder="请输入单据编号查询"></el-input>
        </el-form-item>
        <el-form-item label="供应商名称">
          <el-input v-model="productName" placeholder="请输入商品信息查询"></el-input>
        </el-form-item>
        <el-form-item label=" 单据日期 ">
          <el-date-picker
            v-model="begintime"
            type="datetimerange"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :default-time="['12:00:00']"
          ></el-date-picker>
        </el-form-item>
        <el-form-item>
          <!-- <el-button type="primary"@click="findByPage" >查询</el-button> -->
            <el-button type="primary" plain   @click="findByPage">查询</el-button>
          <el-button @click="resetForm">重置</el-button>
        </el-form-item>
      </el-form>
    </div>



            <!-- table展示 -->
       <div>
         <Table
        border
        
        :columns="columns4"
        :data="data1"
     
      >
           <template  slot-scope="scope" slot="num2">
          <span >{{scope.row.erpAlreadystorage.num}}</span>
        </template>

           <template  slot-scope="scope" slot="unprice">
          <span >{{scope.row.erpAlreadystorage.unitPrice}}</span>
        </template>

           <template  slot-scope="scope" slot="wid">
          <span >{{scope.row.erpWarehouseinformation.resName}}</span>
        </template>

           <template  slot-scope="scope" slot="type">
          <span >{{scope.row.erpCommoditystyle.classificationName}}</span>
        </template>

         <template  slot-scope="scope" slot="data">
          <span >{{scope.row.erpAlreadystorage.documentDate}}</span>
        </template>

         <template  slot-scope="scope" slot="document">
          <span >{{scope.row.erpAlreadystorage.documentNumber}}</span>
        </template>

         <template  slot-scope="scope" slot="supplier">
          <span >{{scope.row.erpAlreadystorage.supplier}}</span>
        </template>

        
      </Table>
    </div>
    <br>



       <!-- 分页 -->
    <div style="float:right">
      <Page
        :total="dataCount"
        :page-size="pageSize"
        @on-change="changepage"
        @on-page-size-change="_nowPageSize"
        show-elevator
      />
    </div>
    <br><br>


<el-tag>未销售</el-tag>

    <!-- 查询没有出库的  okandno=0 -->
    
              <!-- 根据条件查询 -->
              <br><br>
    <div>
       <el-form :inline="true"  class="demo-form-inline" ref="ruleForm">
        <el-form-item label="单据编号">
          <el-input v-model="documentNumber2" placeholder="请输入单据编号查询"></el-input>
        </el-form-item>
        <el-form-item label="供应商名称">
          <el-input v-model="productName2" placeholder="请输入商品信息查询"></el-input>
        </el-form-item>
        <el-form-item label=" 单据日期 ">
          <el-date-picker
            v-model="begintime2"
            type="datetimerange"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :default-time="['12:00:00']"
          ></el-date-picker>
        </el-form-item>
        <el-form-item>
          <!-- <el-button type="primary"@click="findByPage2" >查询</el-button> -->
           <el-button type="primary" plain   @click="findByPage2">查询</el-button>
          <el-button @click="resetForm2">重置</el-button>
        </el-form-item>
      </el-form>
    </div>


    <Table border  :columns="columns5" :data="data2"  height="200" >
       
       

         <template  slot-scope="scope" slot="type">
          <!-- {{scope.row.erpCommoditystyle.classificationName}} -->
          <span >{{scope.row.erpCommoditystyle.classificationName}}</span>
        </template>

        <template  slot-scope="scope" slot="wid">
          <!-- {{scope.row.erpCommoditystyle.classificationName}} -->
          <span >{{scope.row.erpWarehouseinformation.resName}}</span>
        </template>
      </Table>
      <br>






    </div>
</template>
<script>
import axios from "axios";
export default {
   data() {
      return {
         data2:[],
            columns5: [
             
                    
                    {
                        title: '#',
                        key: 'id',
            align:"center",
                    },
                    {
                        title: '供应商',
                        key: 'supplier',
            align:"center",
                    },
                    {
                        title: '单据编号',
                        key: 'documentNumber',
            align:"center",
                    },
                      {
                        title: '入库时间',
                        key: 'storageTime',
            align:"center",
                    },
                     {
                        title: '商品名称',
                        key: 'productName',
            align:"center",
                    },
                   
                     {
                        title: '总金额',
                        key: 'totalAmount',
            align:"center",
                    },   
                       {
                        title: '数量',
                        key: 'num',
            align:"center",
                    },
                      {
                        title: '商品类型',
                        slot: 'type',
            align:"center",
                    },
                       {
                        title: '仓库id',
                        slot: 'wid',
            align:"center",
                    }              
              
                  
                   
                ],



             columns4: [
                 
        {
          title: "商品名称",
          key: "productName",
          align:"center",
        },
        {
            title:"单据编号",
            slot:"document",
            align:"center",
        },
        {
            title:"单据日期",
            slot:"data",
            align:"center",
        },
         {
          title: "供应商",
          slot: "supplier",
          align:"center",
        },
          {
          title: "库存",
          slot: "num2",
          align:"center",
        },
      
          {
          title: "入库单价",
          slot: "unprice",
          align:"center",
        },
        
            {
                title:"销售单价",
                key:"unitPrice",
                align:"center",
            },
          {
          title: "销售数量",
          key: "num",
          align:"center",
        },
        {
            title:"仓库",
            slot:"wid",
            align:"center",
        },
        {
            title:"商品类型",
            slot:"type",
            align:"center",
        }
      ],


      data1: [],
      spinShow:true,

          
      // 分页的条件
      productName: "",
      documentNumber: "",
      begintime: [],


      //分页条件2
       productName2: "",
      documentNumber2: "",
      begintime2: [],


      //分页
        pageSize: 3, //每页显示多少条
      dataCount: 0, //总条数
      pageCurrent: 1, //当前页,


       //分页2
        pageSize2: 4, //每页显示多少条
      dataCount2: 0, //总条数
      pageCurrent2: 1, //当前页,
      }
   },
   created(){
       this.getListByWAndS();
       this.getListByOkandno();
   },

    methods:{

      findByPage2(){
          this.spinShow=true;
 axios
        .post(
          "//localhost:8082/Alreadystorage/getAlreadystoragePage2Okandno?documentNumber=" +
            this.documentNumber2 +
            "&productName=" +
            this.productName2 +
            "&time=" +
            this.begintime2 +
            "&pageSize=" +
            this.pageSize2 +
            "&pageCurrent=" +
             this.pageCurrent2
        )
        .then(res => {
          console.log("99999999999999")
          console.log(res.data);
          this.data2=res.data.list;
         
          //当从数据库获取完毕  关闭加载特效
          this.spinShow=false;
      
        });
      },

      getListByOkandno(){
           axios
        .post(
          "//localhost:8082/Alreadystorage/getAlreadystoragePage2Okandno?documentNumber=" +
            this.documentNumber2 +
            "&productName=" +
            this.productName2 +
            "&time=" +
            this.begintime2 +
            "&pageSize=" +
            this.pageSize2 +
            "&pageCurrent=" +
             this.pageCurrent2
        )
        .then(res => {
          console.log("99999999999999")
          console.log(res.data);
          this.data2=res.data.list;
         
          //当从数据库获取完毕  关闭加载特效
          this.spinShow=false;
      
        });
      },







        // 已经入库和已经出库的查询
        changepage(index) {
       axios
        .post(
          "//localhost:8082/Alreadywarehouse/getAlreadywarehouseStoragePage?documentNumber=" +
            this.documentNumber +
            "&productName=" +
            this.productName +
            "&time=" +
            this.begintime +
            "&pageSize=" +
            this.pageSize +
            "&pageCurrent=" +
            index
        )
        .then(res => {
          console.log("13123123123213")
          console.log(res.data);
          this.dataCount = res.data.countTotal;
          this.data1 = res.data.list;
         
          //当从数据库获取完毕  关闭加载特效
          this.spinShow=false;
          // this.begintime = "";
        });
    },

    //每页显示的数据条数
    _nowPageSize(index) {
      //实时获取当前需要显示的条数
      this.pageSize = index;
    },


        getListByWAndS(){
             axios
        .post(
          "//localhost:8082/Alreadywarehouse/getAlreadywarehouseStoragePage?documentNumber=" +
            this.documentNumber +
            "&productName=" +
            this.productName +
            "&time=" +
            this.begintime +
            "&pageSize=" +
            this.pageSize +
            "&pageCurrent=" +
            this.pageCurrent
        )
        .then(res => {
          console.log("13123123123213")
          console.log(res.data);
          this.dataCount = res.data.countTotal;
          this.data1 = res.data.list;
         
          //当从数据库获取完毕  关闭加载特效
          this.spinShow=false;
          // this.begintime = "";
        });
        },

        
       //查看
    findByPage(){
        this.spinShow=true;
  axios
        .post(
          "//localhost:8082/Alreadywarehouse/getAlreadywarehouseStoragePage?documentNumber=" +
            this.documentNumber +
            "&productName=" +
            this.productName +
            "&time=" +
            this.begintime +
            "&pageSize=" +
            this.pageSize +
            "&pageCurrent=" +
            this.pageCurrent
        )
        .then(res => {
          console.log("13123123123213")
          console.log(res.data);
          this.dataCount = res.data.countTotal;
          this.data1 = res.data.list;
         
          //当从数据库获取完毕  关闭加载特效
          this.spinShow=false;
          // this.begintime = "";
        });
    },










                    // 重置
    resetForm() {
      this.documentNumber = "";
      this.begintime = [];
      this.productName = "";
    },

    resetForm2() {
      this.documentNumber2 = "";
      this.begintime2 = [];
      this.productName2 = "";
    },
    }

}
</script>
